package com.itqf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itqf.entity.SysUser;
import com.itqf.mapper.SysUserMapper;
import com.itqf.service.SysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2021/1/27
 * @Time: 下午2:52
 */
@Service
public class SysUserServiceImpl implements SysUserService {

    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser findByUsername(String username) {
        QueryWrapper queryWrapper = new QueryWrapper();
        //username 设置了唯一约束  根据username查询只能返回一条记录
        queryWrapper.eq("username",username);

        SysUser sysUser = sysUserMapper.selectOne(queryWrapper);
        return sysUser;
    }

    @Override
    public List<String> findRoles(int uid) {

        return sysUserMapper.findRoles(uid);
    }

    @Override
    public List<String> findPerms(int uid) {
        return sysUserMapper.findPerms(uid);
    }
}
